
package contorller;

import common.Exception.Results;
import dto.req.AdminRegisterReqDTO;
import dto.resp.AdminLoginRespDTO;
import dto.resp.AdminQueryWaitViewArticleRespDTO;
import entity.AdminDO;
import service.AdminService;

import java.util.ArrayList;

/**
 * 管理员控制层
 */
public class AdminController {
    private AdminService adminService;

    public AdminController() {
        adminService = new AdminService();
    }

    public Results register(AdminRegisterReqDTO adminDO){
        return adminService.register(adminDO);
    }

    public Results<AdminLoginRespDTO> login(String username, String password){
        return adminService.login(username,password);
    }


    /**
     * 查看所有待审核的文章 , 应该采取分页查询？
     */
    public Results<ArrayList<AdminQueryWaitViewArticleRespDTO>> queryWaitViewArticleAll(Integer idx){
        return adminService.queryWaitViewArticleAll(idx);
    }


    /**
     * 审核功能
     */
    public Results viewArticle(Integer articleId){
        return adminService.viewArticle(articleId);
    }


    public Results deleteArtile(Integer articleId){return adminService.deleteArticle(articleId);}
}
